<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="vlms.bean.Movie"%>
<%@ page import="vlms.bean.IssuedMovie"%>
<%
	IssuedMovie[] issuedMovieList=(IssuedMovie[])request.getAttribute("IssuedMovieList");
	Movie[] movieList=(Movie[])request.getAttribute("MovieList");
	
	
	
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
     function validate(){
         
         if(document.Form.memNumber.value=="")
         {
      alert("Entry required. Enter keyword to search");
      document.Form.memNumber.focus();
      return false;
         }
         return true;
     }
     </script>
<title>ReturnMovie</title>
</head>
<body>
<table width="100%">
<%@ include file="/header.jsp" %>

<tr valign="top" height="50px">
<td align="center">
<%@ include file="/headerLinks.jsp" %>
</td>
</tr>

<% if(request.getAttribute("message") != null) { %>
<tr><td align="center" style="color:red"><%= request.getAttribute("message") %></td></tr>
<% } %>
<tr valign="top"><td align="center" height="300px">
<center>
 <form id="Form" name="Form" method="POST" action="ReturnMovie" onsubmit="return validate();">
<table>
<tr>

<td>
Membership Number: 

  <input type="text" name="memNumber" id="memNumber" value="">
  </td>
  <td>

 <input type="submit" name="Submit" value="GetDetails">
 </td>
 
 </tr>

</table>
</form>

<div class="inputColumn" id="movieList"
			style="text-align: center; border: thin; margin: auto;">
			<table border="1">
				
				<%
				if(issuedMovieList!=null && movieList!=null)
				{
						
						
				%>
				<tr>
					
					<td align="right">
					<label name="moviename" style="size: 30;">Movie Name</label>
					</td>
					<td align="right">
					<label name="moviecategory" style="size: 30;">Movie Category</label>
					</td>
					<td align="right">
					<label name="rentamount" style="size: 30;">Rent Amount</label>
					</td>
					
				</tr>
				
				<%
				
				for(int i=0;i<issuedMovieList.length;i++)
				{
					IssuedMovie issuedMovie=issuedMovieList[i];
					Movie movie=movieList[i];
					if(movie!=null && issuedMovie!=null)
					System.out.println("inside jsp");
				%>
				
				<form name="row" method="post" action="HandleReturnMovie">
				<table border="1">
				<tr >
				
					<td><label
						name="movieName" style="size: 30;"><%=movie.getMoviename()%></label>
					</td>
					
					<td><label
						name="movieCategory" style="size: 30;"><%=movie.getCategory()%></label>
					</td>
					<td><label
						name="rentAmount" style="size: 30;"><%=movie.getRentamount()%></label>
					</td>
					<td>
					<input type="hidden" name="movieId" value='<%=issuedMovie.getMovieid()%>' />
					<input type="hidden" name=issuedId value='<%=issuedMovie.getIssueid()%>' />
					
					<% if(issuedMovie.getIssuedstatus().equals("CURR")) 
					{
					%>
					<input type="submit" value='Return' name="submit" />
					
					<%
					
					}
					%>
				</tr>
				</table>
				</form>
				
				<%
				}
				
				
				}
				%>
      </table>
      </div>

</center>
<%@ include file="/bottom.html" %>
</table>
</body>
</html>